package com.lz.football.module.techBar.item
{
	import com.lz.football.module.base.IComponent;
	
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	
	import lz.controls.LItem;
	import lz.controls.events.ListEvent;

	/**
	 *3种位置item 
	 * @author lake
	 * 
	 */	
	public class TechPlaceItem extends LItem implements IComponent
	{
		/**
		 *选中状态 
		 */		
		private var selectMc :MovieClip;
		
		public function TechPlaceItem()
		{
			super();
		}
		/**
		 * 选择
		 * 
		 */		
		override public function select():void
		{
			if(selectMc)
			{
				_symbolSkin.addChild(selectMc);
			}
		}
		/**
		 * 
		 * 去除选择
		 */		
		override public function unSelect():void
		{
			if(selectMc && selectMc.parent)
			{
				selectMc.parent.removeChild(selectMc);
			}
		}
		/**
		 *初始化 
		 * 
		 */
		public function initUI(view:Object=null):void
		{
			_symbolSkin = view as MovieClip;
			selectMc = _symbolSkin.selectMc;
			unSelect();
			addEvtListener();
		}
		/**
		 *注册事件 
		 * 
		 */	
		public function addEvtListener():void
		{
			_symbolSkin.addEventListener(MouseEvent.CLICK,onItemClickHandler);
		}
		/**
		 *点击 
		 * @param e
		 * 
		 */		
		private function onItemClickHandler(e :MouseEvent):void
		{
			this.dispatchEvent(new ListEvent(ListEvent.ITEM_CLICK,true,false,-1,-1,-1,_data));
		}
		/**
		 *删除事件 
		 * 
		 */	
		public function removeEvtListener():void
		{
			_symbolSkin.removeEventListener(MouseEvent.CLICK,onItemClickHandler);
		}
		/**
		 *销毁 
		 * 
		 */	
		public function destroyView():void
		{
			removeEvtListener();
		}
	}
}